package com.xboss.tv.application;

import android.app.Application;

import com.zhy.http.okhttp.OkHttpUtils;

import java.io.File;
import java.util.concurrent.TimeUnit;

import okhttp3.Cache;
import okhttp3.OkHttpClient;

/**
 * Created by Administrator on 2017/7/17.
 */

public class XbossApp extends Application {

    @Override
    public void onCreate() {
        super.onCreate();

        File sdcache = getExternalCacheDir();
        int cacheSize = 20 * 1024 * 1024;

        OkHttpClient okHttpClient = new OkHttpClient.Builder()
//                .addInterceptor(new LoggerInterceptor("TAG"))
                .connectTimeout(10000L, TimeUnit.MILLISECONDS)
                .readTimeout(10000L, TimeUnit.MILLISECONDS)
                .cache(new Cache(sdcache.getAbsoluteFile(), cacheSize))
                //其他配置
                .build();

        OkHttpUtils.initClient(okHttpClient);
    }
}
